//
//  DealTableViewCell.m
//  BaiTuan
//
//  Created by huiwenjiaoyu on 15/12/23.
//  Copyright © 2015年 YR. All rights reserved.
//

#import "DealTableViewCell.h"
#import "UIImageView+AFNetworking.h"

@implementation DealTableViewCell

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)setDeal:(DealModel *)deal
{
    if (_deal != deal) {
        _deal = deal;
        
        [self loadModelSource];
    }
}

- (void)loadModelSource
{
    [self.dealIcon setImageWithURL:[NSURL URLWithString:_deal.tiny_image] placeholderImage:[UIImage imageNamed:@"bg_merchant_photo_placeholder_big"]];
    self.shopName.text = _deal.title;
    self.dealDescription.text = _deal.dealDescription;
    self.distance.text = [NSString stringWithFormat:@"%.1fkm",_deal.distance.floatValue / 1000];
    self.score.text = [NSString stringWithFormat:@"%@分",_deal.score];
    self.markPrice.text = [NSString stringWithFormat:@"原价:%.1f",_deal.market_price.floatValue / 100];
    self.currenPrice.text = [NSString stringWithFormat:@"￥%.1f",_deal.current_price.floatValue / 100];
}

@end
